import axios from "axios";
import { Cookies } from "./cookie";
const instance = axios.create({
  // baseURL: "http://120.24.64.5:8088/mall-admin",
  baseURL: "http://blue.test/api/",
  timeout: 150000,
});
instance.interceptors.request.use(
  (config) => {
    let token = Cookies.get("yimei_login");
    if (token) {
      config.headers = config.headers || {};
      config.headers.Authorization = token;
    }
    return config;
  },
  (err) => {
    return Promise.reject(err);
  }
);
instance.interceptors.response.use(
  (result) => {
    return result.data;
  },
  (err) => {
    return Promise.reject(err);
  }
);
export default instance;
